Titanium.include("/js/db.js");
var win = Ti.UI.currentWindow;
win.backgroundColor = '#B6CCDD';


var webview = Titanium.UI.createWebView({url:'../html/workflow.html'});
win.add(webview);

Ti.App.addEventListener('app:chooseVideo', function(e) {
Titanium.Media.showCamera({
			success:function(event)
			{
				var video = event.media;
				movieFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mymovie1.mov');
				movieFile.write(video);
			},
			cancel:function()
			{
			},
			error:function(error)
			{
				// create alert
				var a = Titanium.UI.createAlertDialog({title:'Video'});

				// set message
				if (error.code == Titanium.Media.NO_VIDEO)
				{
					a.setMessage('Device does not have video recording capabilities');
				}
				else
				{
					a.setMessage('Unexpected error: ' + error.code);
				}

				// show alert
				a.show();
			},
			mediaTypes: Titanium.Media.MEDIA_TYPE_VIDEO,
			videoMaximumDuration:60000,
			videoQuality:Titanium.Media.QUALITY_HIGH
		});
});

	
	var assessment = [];
	var components =[];
	var qComponent1 = "type:question, value:'Whats the most used video website on internet?'";
	var aComponent1 = "type:answer,value:'www.youtube.com'";
	var QAcomponent1 = ""+qComponent1+","+aComponent1;
	
	var qComponent2 = "type:question,value:'What is 2 + 2?'";
	var aComponent2 = "type:answer,value:'1,2,3,4'";
	var QAcomponent2 = ""+qComponent2+","+aComponent2;
	
	components[0]=QAcomponent1;
	components[1]=QAcomponent2;
	
	assessment[0] ='assessment';
	assessment[1] ='science';
	assessment[2] =components;
	createAssessment(assessment, 1);



